﻿#ifndef APPKEY_H
#define APPKEY_H

#include <QObject>
#include <QDateTime>
#include <Windows.h>
class QTimer;

class AppKey : public QObject
{
    Q_OBJECT
public:
    static AppKey *Instance();
    explicit AppKey(QObject *parent = nullptr);

    int check();


    void createKey();
    int createKey(QString keyData);
    void createKey(QString Serial, int KeySw, QString OverData);

    int getDeadline();
    const QString get_SerialNumber();

private:
    QString getXorEncryptDecrypt(const QString &data, char key);
    void stop();
private:
    static AppKey *self;

    QString m_sKeyData;            //注册码密文
    QString m_sKeySerial;          //序列号
    int m_nKeySw;                  //是否无期限
    QString m_sKeyOverData;        //使用结束日期
    QString m_sKeyStartData;       //当前日期


    int m_nDeadline;

};

#endif // APPKEY_H
